package com.naire.modul.dictionary.service;

import net.common.manager.DictManager;
import net.common.manager.SystemCodeManager;
import net.common.service.GeneralService;
import com.naire.modul.dictionary.dao.DictionaryDao;
import com.naire.modul.dictionary.dao.impl.DictionaryDaoImpl;
import com.naire.modul.dictionary.vo.DictionaryVo;

/**
 * 
 * 
 * @author Administrator
 * 
 */
public class DictionaryEditorService extends GeneralService {

	private DictionaryVo bean;

	@Override
	public void execute() throws Exception {
		DictionaryDao dao = new DictionaryDaoImpl();
		if (bean.getDict_id() != null) {
			dao.update(bean);
		} else {
			bean.setDict_num(SystemCodeManager.createCode("0003"));
			bean.setFlag(0);
			Integer dict_id = dao.insert(bean);
			bean.setDict_id(dict_id);
		}
		DictManager.set(bean.getSort_num(), bean);
	}

	public void setBean(DictionaryVo bean) {
		this.bean = bean;
	}

}
